<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>聊天室申请管理</title>
    <link rel="stylesheet" type="text/css" th:href="@{/js/layui/css/layui.css}" media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/fyn/style.css/}" media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/fyn/my.css/}" media="all">

</head>
<body class="body">
<input th:value="${userId}" id="userId" type="hidden">
<input th:value="${chatroomId}" id="chatroomId" type="hidden">
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <select name="status" lay-filter="aihao">
                <option value=""></option>
                <option value="0">待审核</option>
                <option value="1" selected="">审核通过</option>
                <option value="2">拒绝-仍可申请</option>
                <option value="3">拒绝-不可申请</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

</div>
<!-- 表格 -->
<div id="dateTable" lay-filter="event"></div>
<div class="height50"></div>
<script th:src="@{/js/layui/layui.js}"></script>
<script type="text/javascript" th:inline="javascript">

    // layui方法
    layui.use(['table', 'form', 'laypage', 'layer','laydate'], function () {
        // 操作对象
        var form = layui.form
            , layer = layui.layer
            , $ = layui.jquery;

        //提交事件
        form.on('submit(demo1)', function(data){
            $.ajax({
                url: [[${basePath}]] + "/message/chatroom/applyed",
                data: {
                    userId: $("#userId").val(),
                    chatroomId: $("#chatroomId").val(),
                    status: data.field.status
                },
                type: "post",
                success: function (data) {
                    if (data.success) {
                        layer.msg(data.msg, {icon: 1});
                        setInterval(function () {
                            layer.closeAll();
                            parent.location.reload();
                        }, 1000);

                    } else {
                        layer.msg(data.msg, {icon: 5});
                    }
                }
            });

            return false;
        });

    });
</script>
</body>
</html>